package MySQL;

import Tables.*;
import Tables.Class;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Scanner;

public class Select extends Mysql{

    public Select (Connection connection){
        this.connection = connection;
    }
    public void select() throws SQLException {
        Scanner scan = new Scanner(System.in);
        int opt;
        do{
            getInterface();
            opt = scan.nextInt();
            Table table = null;
            switch(opt){
                case 1:
                    table = new Class(connection);
                    break;
                case 2:
                    table = new Counsellor(connection);
                    break;
                case 3:
                    table = new Course(connection);
                    break;
                case 4:
                    table = new Course_Center(connection);
                    break;
                case 5:
                    table = new Student(connection);
                    break;
                case 6:
                    table = new Teacher(connection);
                    break;
            }
            if(table != null) {
                table.get();
                table.print();
            }
        }while(opt != 0);
    }
}
